package com.fast.develop.dm.meta.factory;

import com.fast.develop.dm.meta.builder.MetaFieldBuilder;
import com.fast.develop.dm.meta.value.ValueValidation;
import com.fast.develop.dm.meta.value.validator.RegExValidator;
import com.fast.develop.dm.meta.value.validator.TypeValidator;
import org.json.JSONObject;

/**
 * @author 莫寅
 * @createTime 2022-06-04 15:58
 * @desc：
 */
public class ValueValidationFactory {

    public static ValueValidation create(String type, JSONObject rawSchema, MetaFieldBuilder metaFieldBuilder){
        ValueValidation valueGeneration = null;
        String value = rawSchema.optString("value", null);
        switch (type){
            case "regEx":
                valueGeneration = new RegExValidator(value);
                break;
            case "type":
                valueGeneration = new TypeValidator(value);
                break;
        }

        return valueGeneration;
    }
}
